home *** CD-ROM | disk | FTP | other *** search
- on GetAutoChannels
- set autoChannels to GG(#gAutoChannels)
- if voidp(autoChannels) then
- set autoChannels to [:]
- setaProp(autoChannels, #lessonRTF, 39)
- setaProp(autoChannels, #lessonShadowRTF, 37)
- setaProp(autoChannels, #listTextFIELD, 38)
- setaProp(autoChannels, #vscrollBITMAP, 40)
- setaProp(autoChannels, #thumbBITMAP, 41)
- setaProp(autoChannels, #upScrollBITMAP, 42)
- setaProp(autoChannels, #downScrollBITMAP, 43)
- setaProp(autoChannels, #navBarBITMAP, 46)
- SG(#gAutoChannels, autoChannels)
- end if
- return autoChannels
- end
-
- on ClearAutoChannelPuppets
- set autoChannels to GG(#gAutoChannels)
- if not voidp(autoChannels) then
- repeat with channelNum in autoChannels
- puppetSprite(channelNum, 0)
- end repeat
- end if
- end
-
- on IsListLineVisible scroller, whichLine
- set topLine to getTopLine(scroller)
- set listWrapList to GG(#gLineWrapList)
- set count to 0
- repeat with lineNum = topLine to whichLine
- set count to count + getAt(listWrapList, lineNum)
- end repeat
- return count <= getNumVisibleLines(scroller)
- end
-
- on MD.Lesson
- set autoChannels to GetAutoChannels()
- set channelSym to getOne(autoChannels, the clickOn)
- case channelSym of
- #listTextFIELD:
- set possibleTN to "T" & string(GG(#gLessonNum))
- if the frameLabel <> possibleTN then
- set hit to inText(GG(#gActiveScroller))
- if hit then
- set stepNum to getSelectedLine(GG(#gActiveScroller)) - 1
- if stepNum <> GG(#gStepNum) then
- go(label(GG(#gLessonPrefix) & string(stepNum)))
- end if
- end if
- end if
- otherwise:
- pass()
- end case
- end
-
- on MD.Menu
- set autoChannels to GetAutoChannels()
- set channelSym to getOne(autoChannels, the clickOn)
- case channelSym of
- #listTextFIELD:
- set hit to inText(GG(#gActiveScroller))
- if hit then
- DoCloseButton()
- end if
- otherwise:
- pass()
- end case
- end
-
- on MD.MenuNavBar
- set mousePos to the clickLoc
- if GG(#gIsSmallWindow) then
- set mousePos to mousePos + point(0, GG(#gDiffSize))
- end if
- if inside(mousePos, rect(130, 240, 200, 252)) then
- set hit to DoButtonHit(#be_pushButton, the clickOn, "NavBar3_Close", "NavBar3", "DoCloseButton", EMPTY, EMPTY, "mdown.aif", "mdown.aif", 0)
- puppetSprite(the clickOn, 0)
- end if
- end
-
- on MD.LessonNavBar
- if the castNum of sprite 46 = the number of member "NavBar2" then
- set hasTryItButton to 1
- else
- set hasTryItButton to 0
- end if
- set mousePos to the clickLoc
- if GG(#gIsSmallWindow) then
- set mousePos to mousePos + point(0, GG(#gDiffSize))
- end if
- set inCast to EMPTY
- if hasTryItButton then
- if inside(mousePos, rect(0, 356, 78, 368)) then
- set inCast to "NavBar2_GoBack"
- set outCast to "NavBar2"
- set cmd to "DoGoBackButton"
- else
- if inside(mousePos, rect(80, 356, 162, 368)) then
- set inCast to "NavBar2_Menu"
- set outCast to "NavBar2"
- set cmd to "DoMenuButton"
- else
- if inside(mousePos, rect(164, 356, 238, 368)) then
- set inCast to "NavBar2_Pause"
- set outCast to "NavBar2"
- set cmd to "DoPauseButton"
- else
- if inside(mousePos, rect(239, 356, 318, 368)) then
- set inCast to "NavBar2_TryIt"
- set outCast to "NavBar2"
- set cmd to "DoTryItButton"
- end if
- end if
- end if
- end if
- else
- if inside(mousePos, rect(0, 356, 78, 368)) then
- set inCast to "NavBar1_GoBack"
- set outCast to "NavBar1"
- set cmd to "DoGoBackButton"
- else
- if inside(mousePos, rect(80, 356, 162, 368)) then
- set inCast to "NavBar1_Menu"
- set outCast to "NavBar1"
- set cmd to "DoMenuButton"
- else
- if inside(mousePos, rect(164, 356, 238, 368)) then
- set inCast to "NavBar1_Pause"
- set outCast to "NavBar1"
- set cmd to "DoPauseButton"
- else
- if inside(mousePos, rect(239, 356, 318, 368)) then
- set inCast to "NavBar1_GoNext"
- set outCast to "NavBar1"
- set cmd to "DoGoNextButton"
- end if
- end if
- end if
- end if
- end if
- if inCast <> EMPTY then
- set hit to DoButtonHit(#be_pushButton, the clickOn, inCast, outCast, cmd, EMPTY, EMPTY, "mdown.aif", "mdown.aif", 0)
- puppetSprite(the clickOn, 0)
- end if
- end
-
- on DoGoBackButton
- set lessonNum to GG(#gLessonNum)
- if GG(#gInTryIt) then
- set labelName to GG(#gLessonPrefix) & "0"
- else
- set lessonList to GG(#gLessonList)
- set pos to findPos(lessonList, lessonNum)
- if pos <= 0 then
- set pos to count(lessonList)
- end if
- set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
- end if
- ClearAutoChannelPuppets()
- go(label(labelName))
- if GG(#gInTryIt) then
- DoGrowWindow()
- setHiliteFlag(GG(#gActiveScroller), 1)
- SG(#gInTryIt, 0)
- end if
- end
-
- on DoGoNextButton
- set lessonNum to GG(#gLessonNum)
- set lessonList to GG(#gLessonList)
- set pos to findPos(lessonList, lessonNum)
- set pos to pos + 1
- if pos > count(lessonList) then
- set pos to 1
- end if
- set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
- ClearAutoChannelPuppets()
- go(label(labelName))
- if GG(#gInTryIt) then
- DoGrowWindow()
- setHiliteFlag(GG(#gActiveScroller), 1)
- SG(#gInTryIt, 0)
- end if
- end
-
- on DoMenuButton
- ClearAutoChannelPuppets()
- set wind to MyTutorWindow()
- SG(#gTutorWindow, wind)
- if not voidp(wind) then
- SG(#gBigDrawRect, rect(0, 0, 320, 364))
- SG(#gDiffSize, 240)
- DoShrinkWindow()
- end if
- go("Menu")
- end
-
- on DoPauseButton
- SG(#gPaused, not GG(#gPaused))
- end
-
- on DoCloseButton
- set pos to getSelectedLine(GG(#gActiveScroller))
- set lessonList to GG(#gLessonList)
- set labelName to getaProp(getAt(lessonList, pos), #firstLabel)
- ClearAutoChannelPuppets()
- CG(#gLessonNum)
- go(label(labelName))
- DoGrowWindow()
- end
-
- on DoTryItButton
- set wind to MyTutorWindow()
- SG(#gTutorWindow, wind)
- if not voidp(wind) then
- SG(#gBigDrawRect, rect(0, 0, 320, 364))
- SG(#gDiffSize, 240)
- DoShrinkWindow()
- end if
- set lessonList to GG(#gLessonList)
- set nextFrame to getaProp(getaProp(lessonList, GG(#gLessonNum)), #tryItFrame)
- go(nextFrame)
- setHiliteFlag(GG(#gActiveScroller), 0)
- dataChanged(GG(#gActiveScroller))
- SG(#gInTryIt, 1)
- end
-
- on DoShrinkWindow
- set wind to GG(#gTutorWindow)
- if not voidp(wind) then
- set diffSize to GG(#gDiffSize)
- if getAt(the drawRect of wind, 2) >= 0 then
- set the rect of wind to the rect of wind + rect(0, diffSize, 0, 0)
- set the drawRect of wind to the drawRect of wind - rect(0, diffSize, 0, diffSize)
- end if
- SG(#gIsSmallWindow, 1)
- end if
- end
-
- on DoGrowWindow
- set wind to GG(#gTutorWindow)
- if not voidp(wind) then
- set diffSize to GG(#gDiffSize)
- if getAt(the drawRect of wind, 2) < 0 then
- set the rect of wind to the rect of wind - rect(0, diffSize, 0, 0)
- set the drawRect of wind to the drawRect of wind + rect(0, diffSize, 0, diffSize)
- end if
- SG(#gIsSmallWindow, 0)
- end if
- end
-